home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / shells / sh03src.zoo / sh-pl03 / sh / sh03diffs < prev    next >
Encoding:
Text File  |  1993-06-06  |  32.9 KB  |  1,296 lines

  1. diff --context --recursive --new-file bsd-sh/Makefile sh03/Makefile
  2. *** bsd-sh/Makefile    Fri Feb 19 08:41:42 1993
  3. --- sh03/Makefile    Wed Jun  2 01:22:16 1993
  4. ***************
  5. *** 1,46 ****
  6.   #    %W% (Berkeley) %G%
  7.   
  8.   PROG=    sh
  9. ! SRCS=    builtins.c cd.c dirent.c echo.c error.c eval.c exec.c expand.c \
  10.       input.c jobs.c mail.c main.c memalloc.c miscbltin.c \
  11.       mystring.c nodes.c options.c parser.c redir.c show.c signames.c \
  12.       syntax.c trap.c output.c var.c
  13. ! OBJS+=    init.o
  14. ! CFLAGS+=-DSHELL -I. -I${.CURDIR}
  15. ! .PATH:    ${.CURDIR}/bltin
  16. ! CLEANFILES+=\
  17. !     builtins.c builtins.h init.c mkinit mknodes mksignames mksyntax \
  18. !     nodes.c nodes.h signames.c signames.h syntax.c syntax.h token.def
  19.   
  20. ! .depend parser.o: token.def
  21.   token.def: mktokens
  22. !     sh ${.CURDIR}/mktokens
  23.   
  24. ! builtins.h builtins.c: ${.CURDIR}/mkbuiltins ${.CURDIR}/builtins
  25. !     cd ${.CURDIR}; sh mkbuiltins
  26.   
  27. ! init.c: mkinit ${SRCS}
  28. !     ./mkinit '${CC} -c ${CFLAGS} init.c' ${.ALLSRC}
  29.   
  30. ! mkinit: ${.CURDIR}/mkinit.c
  31. !     ${CC} ${CFLAGS} ${.CURDIR}/mkinit.c -o $@
  32.   
  33. ! nodes.c nodes.h: mknodes ${.CURDIR}/nodetypes ${.CURDIR}/nodes.c.pat
  34. !     ./mknodes ${.CURDIR}/nodetypes ${.CURDIR}/nodes.c.pat
  35.   
  36. ! mknodes: ${.CURDIR}/mknodes.c
  37. !     ${CC} ${CFLAGS} ${.CURDIR}/mknodes.c -o $@
  38.   
  39.   signames.c signames.h: mksignames
  40.       ./mksignames
  41.   
  42. ! mksignames: ${.CURDIR}/mksignames.c
  43. !     ${CC} ${CFLAGS} ${.CURDIR}/mksignames.c -o $@
  44.   
  45.   syntax.c syntax.h: mksyntax
  46.       ./mksyntax
  47.   
  48. ! mksyntax: ${.CURDIR}/mksyntax.c ${.CURDIR}/parser.h
  49. !     ${CC} ${CFLAGS} ${.CURDIR}/mksyntax.c -o $@
  50.   
  51. ! .include <bsd.prog.mk>
  52. --- 1,123 ----
  53.   #    %W% (Berkeley) %G%
  54.   
  55. + # Makefile for Kenneth Almquist's Bourne Shell for Atari ST/MiNT
  56. + # hohmuth 21 Mar 1993
  57. + # 
  58. + # This Makefile needs GNU Make.
  59.   PROG=    sh
  60. ! SRCS=    builtins.c cd.c dirent.c bltin/echo.c error.c eval.c exec.c expand.c \
  61.       input.c jobs.c mail.c main.c memalloc.c miscbltin.c \
  62.       mystring.c nodes.c options.c parser.c redir.c show.c signames.c \
  63.       syntax.c trap.c output.c var.c
  64. ! OBJS=    $(patsubst %.c,%.o,$(SRCS)) init.o
  65. ! CC=    gcc $(MODEL) -O2 -fomit-frame-pointer -fstrength-reduce
  66. ! CFLAGS=    -I. -Ibltin $(DEFS)
  67. ! MODEL=    -mbaserel
  68. ! DEFS=    -DDOSFS -DSHELL -DENOTDIR=EPATH
  69. ! POSTPROC1=    toglclr -fload -fram -frun
  70. ! all:    $(PROG)
  71. ! $(PROG): $(OBJS)
  72. !     $(CC) -o $@ $^ -lbiio
  73. ! ifdef POSTPROC1
  74. !     $(POSTPROC1) $@
  75. ! endif
  76. ! %.o:    %.c
  77. !     $(CC) $(CFLAGS) -o $@ -c $<
  78.   
  79. ! parser.o: token.def
  80.   token.def: mktokens
  81. !     /bin/sh mktokens
  82.   
  83. ! builtins.h builtins.c: mkbuiltins builtins
  84. !     /bin/sh mkbuiltins
  85.   
  86. ! init.o: mkinit ${SRCS}
  87. !     ./mkinit '${CC} -c ${CFLAGS} init.c' ${SRCS}
  88.   
  89. ! mkinit: mkinit.c
  90. !     ${CC} ${CFLAGS} mkinit.c -o $@
  91.   
  92. ! nodes.c nodes.h: mknodes nodetypes nodes.c.pat
  93. !     ./mknodes nodetypes nodes.c.pat
  94.   
  95. ! mknodes: mknodes.c
  96. !     ${CC} ${CFLAGS} mknodes.c -o $@
  97.   
  98.   signames.c signames.h: mksignames
  99.       ./mksignames
  100.   
  101. ! mksignames: mksignames.c
  102. !     ${CC} ${CFLAGS} mksignames.c -o $@
  103.   
  104.   syntax.c syntax.h: mksyntax
  105.       ./mksyntax
  106.   
  107. ! mksyntax: mksyntax.c parser.h
  108. !     ${CC} ${CFLAGS} mksyntax.c -o $@
  109.   
  110. ! .PHONY: clean
  111. ! clean:
  112. !     -rm -f ${OBJS}
  113. ! .PHONY: realclean
  114. ! realclean: clean
  115. !     -rm -f mksyntax syntax.c syntax.h
  116. !     -rm -f mksignames signames.c signames.h
  117. !     -rm -f mknodes nodes.c nodes.h
  118. !     -rm -f mkinit init.c
  119. !     -rm -f builtins.c builtins.h
  120. !     -rm -f token.def
  121. !     -rm -f ${PROG}
  122. ! ### dependencies
  123. ! builtins: ;
  124. ! builtins.o : builtins.c shell.h builtins.h 
  125. ! cd.o : cd.c shell.h var.h nodes.h jobs.h options.h output.h memalloc.h error.h \
  126. !   mystring.h 
  127. ! dirent.o : dirent.c shell.h 
  128. ! error.o : error.c shell.h main.h options.h output.h error.h
  129. ! mksyntax.o : mksyntax.c parser.h 
  130. ! eval.o : eval.c shell.h nodes.h syntax.h expand.h parser.h jobs.h eval.h builtins.h \
  131. !   options.h exec.h redir.h input.h output.h trap.h var.h memalloc.h error.h mystring.h 
  132. ! exec.o : exec.c shell.h main.h nodes.h parser.h redir.h eval.h exec.h builtins.h \
  133. !   var.h options.h input.h output.h syntax.h memalloc.h error.h init.h mystring.h 
  134. ! expand.o : expand.c shell.h main.h nodes.h eval.h expand.h syntax.h parser.h \
  135. !   jobs.h options.h var.h input.h output.h memalloc.h error.h mystring.h 
  136. ! input.o : input.c shell.h syntax.h input.h output.h memalloc.h error.h 
  137. ! mksignames.o : mksignames.c 
  138. ! jobs.o : jobs.c shell.h main.h parser.h nodes.h jobs.h \
  139. !   options.h trap.h signames.h syntax.h input.h output.h memalloc.h error.h mystring.h 
  140. ! mail.o : mail.c shell.h exec.h var.h output.h memalloc.h error.h 
  141. ! main.o : main.c shell.h main.h mail.h options.h output.h parser.h nodes.h eval.h \
  142. !   jobs.h input.h trap.h memalloc.h error.h init.h mystring.h 
  143. ! memalloc.o : memalloc.c shell.h output.h memalloc.h error.h machdep.h mystring.h 
  144. ! miscbltin.o : miscbltin.c shell.h options.h var.h output.h memalloc.h error.h \
  145. !   mystring.h 
  146. ! mystring.o : mystring.c shell.h syntax.h error.h mystring.h 
  147. ! nodes.o : nodes.c shell.h nodes.h memalloc.h machdep.h mystring.h 
  148. ! options.o : options.c shell.h options.h nodes.h eval.h jobs.h input.h output.h \
  149. !   trap.h var.h memalloc.h error.h mystring.h 
  150. ! parser.o : parser.c shell.h parser.h nodes.h expand.h redir.h syntax.h options.h \
  151. !   input.h output.h var.h error.h memalloc.h mystring.h token.def 
  152. ! redir.o : redir.c shell.h nodes.h jobs.h expand.h redir.h output.h memalloc.h \
  153. !   error.h 
  154. ! show.o : show.c shell.h parser.h nodes.h mystring.h 
  155. ! signames.o : signames.c shell.h 
  156. ! syntax.o : syntax.c shell.h syntax.h 
  157. ! trap.o : trap.c shell.h main.h nodes.h eval.h jobs.h options.h syntax.h signames.h \
  158. !   output.h memalloc.h error.h trap.h mystring.h 
  159. ! output.o : output.c shell.h syntax.h output.h memalloc.h error.h
  160. ! var.o : var.c shell.h output.h expand.h nodes.h eval.h exec.h syntax.h options.h \
  161. !   mail.h var.h memalloc.h error.h mystring.h 
  162. ! init.o : shell.h mystring.h eval.h input.h error.h options.h redir.h \
  163. !   signames.h trap.h output.h memalloc.h var.h 
  164. diff --context --recursive --new-file bsd-sh/builtins sh03/builtins
  165. *** bsd-sh/builtins    Fri Feb 19 08:41:56 1993
  166. --- sh03/builtins    Sat May 22 00:41:42 1993
  167. ***************
  168. *** 61,66 ****
  169. --- 61,67 ----
  170.   exitcmd        exit
  171.   exportcmd    export readonly
  172.   #exprcmd    expr test [
  173. + falsecmd    false
  174.   fgcmd -j    fg
  175.   getoptscmd    getopts
  176.   hashcmd        hash
  177. diff --context --recursive --new-file bsd-sh/cd.c sh03/cd.c
  178. *** bsd-sh/cd.c    Fri Feb 19 08:42:02 1993
  179. --- sh03/cd.c    Sun Mar 21 14:49:26 1993
  180. ***************
  181. *** 187,193 ****
  182.               i += strlen(cdcomppath);
  183.           p = stalloc(i);
  184.           if (readlink(symlink, p, (int)statb.st_size) < 0) {
  185. !             error("readlink %s failed", stackblock());
  186.           }
  187.           if (cdcomppath != NULL) {
  188.               p[(int)statb.st_size] = '/';
  189. --- 187,193 ----
  190.               i += strlen(cdcomppath);
  191.           p = stalloc(i);
  192.           if (readlink(symlink, p, (int)statb.st_size) < 0) {
  193. !             error("readlink %s failed", symlink);
  194.           }
  195.           if (cdcomppath != NULL) {
  196.               p[(int)statb.st_size] = '/';
  197. ***************
  198. *** 343,349 ****
  199.               close(pip[1]);
  200.           }
  201.           execl("/bin/pwd", "pwd", (char *)0);
  202. !         error("Cannot exec /bin/pwd");
  203.       }
  204.       close(pip[1]);
  205.       pip[1] = -1;
  206. --- 343,350 ----
  207.               close(pip[1]);
  208.           }
  209.           execl("/bin/pwd", "pwd", (char *)0);
  210. ! /*        error("Cannot exec /bin/pwd");    */    
  211. !         exitshell(-1);
  212.       }
  213.       close(pip[1]);
  214.       pip[1] = -1;
  215. ***************
  216. *** 358,366 ****
  217. --- 359,374 ----
  218.       status = waitforjob(jp);
  219.       if (status != 0)
  220.           error((char *)0);
  221. + #ifdef __MINT__
  222. +     if (i < 0 || p == buf || !( p[-1] == '\n' || p[-1] == '\r'))
  223. +         error("pwd command failed");
  224. +     while (--p, (*p == '\n' || *p == '\r'))
  225. +         *p = 0;
  226. + #else
  227.       if (i < 0 || p == buf || p[-1] != '\n')
  228.           error("pwd command failed");
  229.       p[-1] = '\0';
  230. + #endif
  231.       curdir = savestr(buf);
  232.       INTON;
  233.   }
  234. diff --context --recursive --new-file bsd-sh/error.c sh03/error.c
  235. *** bsd-sh/error.c    Fri Feb 19 08:42:26 1993
  236. --- sh03/error.c    Sun Mar 21 14:56:00 1993
  237. ***************
  238. *** 179,195 ****
  239.   STATIC const struct errname errormsg[] = {
  240.       EINTR, ALL,    "interrupted",
  241.       EACCES, ALL,    "permission denied",
  242.       EIO, ALL,        "I/O error",
  243.       ENOENT, E_OPEN,    "no such file",
  244.       ENOENT, E_CREAT,    "directory nonexistent",
  245.       ENOENT, E_EXEC,    "not found",
  246.       ENOTDIR, E_OPEN,    "no such file",
  247.       ENOTDIR, E_CREAT,    "directory nonexistent",
  248.       ENOTDIR, E_EXEC,    "not found",
  249.       EISDIR, ALL,    "is a directory",
  250. ! /*    EMFILE, ALL,    "too many open files", */
  251.       ENFILE, ALL,    "file table overflow",
  252.       ENOSPC, ALL,    "file system full",
  253.   #ifdef EDQUOT
  254.       EDQUOT, ALL,    "disk quota exceeded",
  255.   #endif
  256. --- 179,205 ----
  257.   STATIC const struct errname errormsg[] = {
  258.       EINTR, ALL,    "interrupted",
  259.       EACCES, ALL,    "permission denied",
  260. + #ifdef EIO
  261.       EIO, ALL,        "I/O error",
  262. + #endif
  263.       ENOENT, E_OPEN,    "no such file",
  264.       ENOENT, E_CREAT,    "directory nonexistent",
  265.       ENOENT, E_EXEC,    "not found",
  266.       ENOTDIR, E_OPEN,    "no such file",
  267.       ENOTDIR, E_CREAT,    "directory nonexistent",
  268.       ENOTDIR, E_EXEC,    "not found",
  269. + #ifdef EISDIR
  270.       EISDIR, ALL,    "is a directory",
  271. ! #endif
  272. ! #ifdef EMFILE 
  273. !     EMFILE, ALL,    "too many open files",
  274. ! #endif
  275. ! #ifdef ENFILE
  276.       ENFILE, ALL,    "file table overflow",
  277. + #endif
  278. + #ifdef ENOSPC
  279.       ENOSPC, ALL,    "file system full",
  280. + #endif
  281.   #ifdef EDQUOT
  282.       EDQUOT, ALL,    "disk quota exceeded",
  283.   #endif
  284. ***************
  285. *** 198,204 ****
  286. --- 208,216 ----
  287.   #endif
  288.       ENXIO, ALL,    "no such device or address",
  289.       EROFS, ALL,    "read-only file system",
  290. + #ifdef ETXTBSY
  291.       ETXTBSY, ALL,    "text busy",
  292. + #endif
  293.   #ifdef SYSV
  294.       EAGAIN, E_EXEC,    "not enough memory",
  295.   #endif
  296. ***************
  297. *** 221,227 ****
  298. --- 233,241 ----
  299.   #ifdef ELOOP
  300.       ELOOP, ALL,    "symbolic link loop",
  301.   #endif
  302. + #ifdef E2BIG
  303.       E2BIG, E_EXEC,    "argument list too long",
  304. + #endif
  305.   #ifdef ELIBACC
  306.       ELIBACC, E_EXEC,    "shared library missing",
  307.   #endif
  308. ***************
  309. *** 240,245 ****
  310. --- 254,263 ----
  311.       struct errname const *ep;
  312.       static char buf[12];
  313.   
  314. + #ifdef __MINT__
  315. +     if (e < 32) 
  316. +         return "I/O error";
  317. + #endif
  318.       for (ep = errormsg ; ep->errcode ; ep++) {
  319.           if (ep->errcode == e && (ep->action & action) != 0)
  320.               return ep->msg;
  321. diff --context --recursive --new-file bsd-sh/error.h sh03/error.h
  322. *** bsd-sh/error.h    Fri Feb 19 08:42:32 1993
  323. --- sh03/error.h    Wed Feb 17 04:27:32 1993
  324. ***************
  325. *** 108,113 ****
  326. --- 108,115 ----
  327.    */
  328.   
  329.   #ifdef BSD
  330. + #ifndef __MINT__
  331.   #define setjmp(jmploc)    _setjmp(jmploc)
  332.   #define longjmp(jmploc, val)    _longjmp(jmploc, val)
  333.   #endif
  334. + #endif
  335. diff --context --recursive --new-file bsd-sh/eval.c sh03/eval.c
  336. *** bsd-sh/eval.c    Fri Feb 19 08:42:40 1993
  337. --- sh03/eval.c    Sat May 22 00:41:46 1993
  338. ***************
  339. *** 899,904 ****
  340. --- 899,907 ----
  341.       return ret;
  342.   }
  343.   
  344. + falsecmd(argc, argv) char **argv; {
  345. +     return 1;
  346. + }
  347.   
  348.   truecmd(argc, argv)  char **argv; {
  349.       return 0;
  350. diff --context --recursive --new-file bsd-sh/exec.c sh03/exec.c
  351. *** bsd-sh/exec.c    Fri Feb 19 08:42:56 1993
  352. --- sh03/exec.c    Wed Feb 17 06:13:50 1993
  353. ***************
  354. *** 69,74 ****
  355. --- 69,80 ----
  356.   #include <fcntl.h>
  357.   #include <errno.h>
  358.   
  359. + #ifdef __MINT__
  360. + /* Defines order in which to look for executable program suffixes */
  361. + static const char *const suffixes[] = {
  362. +     "", ".ttp", ".tos", ".prg", 0
  363. + };
  364. + #endif
  365.   
  366.   #define CMDTABLESIZE 31        /* should be prime */
  367.   #define ARB 1            /* actual size determined at run time */
  368. ***************
  369. *** 150,164 ****
  370.       do {
  371.           execve(cmd, argv, envp);
  372.       } while (errno == EINTR);
  373. ! #else
  374.       execve(cmd, argv, envp);
  375. ! #endif
  376.       e = errno;
  377.       if (e == ENOEXEC) {
  378.           initshellproc();
  379.           setinputfile(cmd, 0);
  380.           commandname = arg0 = savestr(argv[0]);
  381. ! #ifndef BSD
  382.           pgetc(); pungetc();        /* fill up input buffer */
  383.           p = parsenextc;
  384.           if (parsenleft > 2 && p[0] == '#' && p[1] == '!') {
  385. --- 156,187 ----
  386.       do {
  387.           execve(cmd, argv, envp);
  388.       } while (errno == EINTR);
  389. ! #else /* !SYSV */
  390. ! #ifdef __MINT__
  391. !     {
  392. !         const char *const *suffix;
  393. !         long len = strlen(cmd);
  394. !         char *xcmd = alloca(len+5);
  395. !         strcpy(xcmd,cmd);
  396. !         for (suffix = suffixes; *suffix; suffix++) {
  397. !             strcpy(xcmd + len, *suffix);
  398. !             execve(xcmd, argv, envp);
  399. !             
  400. !             if (errno == ENOEXEC) break;
  401. !         } 
  402. !     }
  403. ! #else /* !__MINT__, !SYSV */
  404.       execve(cmd, argv, envp);
  405. ! #endif /* !__MINT__ */
  406. ! #endif /* !SYSV */
  407.       e = errno;
  408.       if (e == ENOEXEC) {
  409.           initshellproc();
  410.           setinputfile(cmd, 0);
  411.           commandname = arg0 = savestr(argv[0]);
  412. ! #if defined(__MINT__) || !defined(BSD)
  413.           pgetc(); pungetc();        /* fill up input buffer */
  414.           p = parsenextc;
  415.           if (parsenleft > 2 && p[0] == '#' && p[1] == '!') {
  416. ***************
  417. *** 174,180 ****
  418.   }
  419.   
  420.   
  421. ! #ifndef BSD
  422.   /*
  423.    * Execute an interpreter introduced by "#!", for systems where this
  424.    * feature has not been built into the kernel.  If the interpreter is
  425. --- 197,203 ----
  426.   }
  427.   
  428.   
  429. ! #if defined(__MINT__) || !defined(BSD) 
  430.   /*
  431.    * Execute an interpreter introduced by "#!", for systems where this
  432.    * feature has not been built into the kernel.  If the interpreter is
  433. ***************
  434. *** 212,223 ****
  435.               goto bad;
  436.           if ((c = *inp++) == '\n')
  437.               break;
  438.           if (ap == &newargs[NEWARGS])
  439.   bad:          error("Bad #! line");
  440.           STARTSTACKSTR(outp);
  441.           do {
  442.               STPUTC(c, outp);
  443. !         } while (--n >= 0 && (c = *inp++) != ' ' && c != '\t' && c != '\n');
  444.           STPUTC('\0', outp);
  445.           n++, inp--;
  446.           *ap++ = grabstackstr(outp);
  447. --- 235,255 ----
  448.               goto bad;
  449.           if ((c = *inp++) == '\n')
  450.               break;
  451. + #ifdef __MINT__
  452. +         if (c == '\r')
  453. +             break;
  454. + #endif
  455.           if (ap == &newargs[NEWARGS])
  456.   bad:          error("Bad #! line");
  457.           STARTSTACKSTR(outp);
  458.           do {
  459.               STPUTC(c, outp);
  460. !         } 
  461. !         while (--n >= 0 && (c = *inp++) != ' ' && c != '\t' 
  462. ! #ifdef __MINT__
  463. !             && c != '\r'
  464. ! #endif
  465. !             && c != '\n');
  466.           STPUTC('\0', outp);
  467.           n++, inp--;
  468.           *ap++ = grabstackstr(outp);
  469. ***************
  470. *** 459,473 ****
  471.               TRACE(("searchexec \"%s\": no change\n", name));
  472.               goto success;
  473.           }
  474.           while (stat(fullname, &statb) < 0) {
  475. ! #ifdef SYSV
  476.               if (errno == EINTR)
  477.                   continue;
  478. ! #endif
  479.               if (errno != ENOENT && errno != ENOTDIR)
  480.                   e = errno;
  481.               goto loop;
  482.           }
  483.           e = EACCES;    /* if we fail, this will be the error */
  484.           if ((statb.st_mode & S_IFMT) != S_IFREG)
  485.               goto loop;
  486. --- 491,525 ----
  487.               TRACE(("searchexec \"%s\": no change\n", name));
  488.               goto success;
  489.           }
  490. + #ifdef __MINT__
  491. +         {
  492. +             const char *const *suffix;
  493. +             long len = strlen(fullname);
  494. +             char *xcmd = alloca(len+5);
  495. +             strcpy(xcmd,fullname);
  496. +             for (suffix = suffixes; *suffix; suffix++) {
  497. +                 strcpy(xcmd + len, *suffix);
  498. +                 if (stat(xcmd, &statb) >= 0)
  499. +                     break;
  500. +             } 
  501. +             
  502. +             if (*suffix == 0)
  503. +                 /* All suffixes tried to no avail */
  504. +                 goto loop;
  505. +         }
  506. + #else /* !__MINT__*/
  507.           while (stat(fullname, &statb) < 0) {
  508. ! # ifdef SYSV
  509.               if (errno == EINTR)
  510.                   continue;
  511. ! # endif
  512.               if (errno != ENOENT && errno != ENOTDIR)
  513.                   e = errno;
  514.               goto loop;
  515.           }
  516. + #endif /* !__MINT__ */
  517.           e = EACCES;    /* if we fail, this will be the error */
  518.           if ((statb.st_mode & S_IFMT) != S_IFREG)
  519.               goto loop;
  520. diff --context --recursive --new-file bsd-sh/expand.c sh03/expand.c
  521. *** bsd-sh/expand.c    Fri Feb 19 08:43:16 1993
  522. --- sh03/expand.c    Sat May 22 00:44:06 1993
  523. ***************
  524. *** 286,298 ****
  525. --- 286,306 ----
  526.               in.nleft = i - 1;
  527.           }
  528.           lastc = *p++;
  529. + #ifdef __MINT__
  530. +         if (lastc != '\0' && lastc != '\r') {
  531. + #else
  532.           if (lastc != '\0') {
  533. + #endif
  534.               if (full && syntax[lastc] == CCTL)
  535.                   STPUTC(CTLESC, dest);
  536.               STPUTC(lastc, dest);
  537.           }
  538.       }
  539. + #ifdef __MINT__
  540. +     if (lastc == '\n' || lastc == '\r') {
  541. + #else
  542.       if (lastc == '\n') {
  543. + #endif
  544.           STUNPUTC(dest);
  545.       }
  546.       if (in.fd >= 0)
  547. ***************
  548. *** 300,306 ****
  549.       if (in.buf)
  550.           ckfree(in.buf);
  551.       if (in.jp)
  552. !         waitforjob(in.jp);
  553.       if (quoted == 0)
  554.           recordregion(startloc, dest - stackblock(), 0);
  555.       TRACE(("evalbackq: size=%d: \"%.*s\"\n",
  556. --- 308,314 ----
  557.       if (in.buf)
  558.           ckfree(in.buf);
  559.       if (in.jp)
  560. !         exitstatus = waitforjob(in.jp);
  561.       if (quoted == 0)
  562.           recordregion(startloc, dest - stackblock(), 0);
  563.       TRACE(("evalbackq: size=%d: \"%.*s\"\n",
  564. ***************
  565. *** 499,505 ****
  566.       case '*':
  567.           sep = ' ';
  568.   allargs:
  569. !         syntax = quoted? DQSYNTAX : BASESYNTAX;
  570.           for (ap = shellparam.p ; (p = *ap++) != NULL ; ) {
  571.               /* should insert CTLESC characters */
  572.               while (*p) {
  573. --- 507,515 ----
  574.       case '*':
  575.           sep = ' ';
  576.   allargs:
  577. !         /* Only emit CTLESC if we will do further processing,
  578. !            i.e. if allow_split is set.  */
  579. !         syntax = quoted && allow_split ? DQSYNTAX : BASESYNTAX;
  580.           for (ap = shellparam.p ; (p = *ap++) != NULL ; ) {
  581.               /* should insert CTLESC characters */
  582.               while (*p) {
  583. ***************
  584. *** 514,520 ****
  585.       case '0':
  586.           p = arg0;
  587.   string:
  588. !         syntax = quoted? DQSYNTAX : BASESYNTAX;
  589.           while (*p) {
  590.               if (syntax[*p] == CCTL)
  591.                   STPUTC(CTLESC, expdest);
  592. --- 524,532 ----
  593.       case '0':
  594.           p = arg0;
  595.   string:
  596. !         /* Only emit CTLESC if we will do further processing,
  597. !            i.e. if allow_split is set.  */
  598. !         syntax = quoted && allow_split ? DQSYNTAX : BASESYNTAX;
  599.           while (*p) {
  600.               if (syntax[*p] == CCTL)
  601.                   STPUTC(CTLESC, expdest);
  602. ***************
  603. *** 1095,1101 ****
  604.       argbackq = pattern->narg.backquote;
  605.       STARTSTACKSTR(expdest);
  606.       ifslastp = NULL;
  607. !     argstr(pattern->narg.text, 0);
  608.       STPUTC('\0', expdest);
  609.       p = grabstackstr(expdest);
  610.       result = patmatch(p, val);
  611. --- 1107,1115 ----
  612.       argbackq = pattern->narg.backquote;
  613.       STARTSTACKSTR(expdest);
  614.       ifslastp = NULL;
  615. !     /* Preserve any CTLESC characters inserted previously, so that
  616. !        we won't expand reg exps which are inside strings.  */
  617. !     argstr(pattern->narg.text, 1);
  618.       STPUTC('\0', expdest);
  619.       p = grabstackstr(expdest);
  620.       result = patmatch(p, val);
  621. diff --context --recursive --new-file bsd-sh/input.c sh03/input.c
  622. *** bsd-sh/input.c    Fri Feb 19 08:43:34 1993
  623. --- sh03/input.c    Sun Mar 21 15:15:42 1993
  624. ***************
  625. *** 181,200 ****
  626. --- 181,211 ----
  627.       p = parsenextc = parsefile->buf;
  628.       i = read(parsefile->fd, p, BUFSIZ);
  629.       if (i <= 0) {
  630. + #ifndef __MINT__
  631.                   if (i < 0) {
  632. + #endif
  633.                           if (errno == EINTR)
  634.                                   goto retry;
  635. + #ifndef __MINT__
  636.                           if (parsefile->fd == 0 && errno == EWOULDBLOCK) {
  637.                                   int flags = fcntl(0, F_GETFL, 0);
  638.                                   if (flags >= 0 && flags & O_NONBLOCK) {
  639.                                           flags &=~ O_NONBLOCK;
  640. + #else
  641. +                         if (parsefile->fd == 0 && i == 0) {
  642. +                                 int flags = fcntl(0, F_GETFL, 0);
  643. +                                 if (flags >= 0 && flags & O_NDELAY) {
  644. +                                         flags &=~ O_NDELAY;
  645. + #endif
  646.                                           if (fcntl(0, F_SETFL, flags) >= 0) {
  647.                           out2str("sh: turning off NDELAY mode\n");
  648.                                                   goto retry;
  649.                                           }
  650.                                   }
  651.                           }
  652. + #ifndef __MINT__
  653.                   }
  654. + #endif
  655.                   parsenleft = EOF_NLEFT;
  656.                   return PEOF;
  657.       }
  658. ***************
  659. *** 202,207 ****
  660. --- 213,224 ----
  661.   
  662.       /* delete nul characters */
  663.       for (;;) {
  664. + #ifdef __MINT__
  665. +         if (*p == '\r') {
  666. +             p++;
  667. +             break;
  668. +         }
  669. + #endif
  670.           if (*p++ == '\0')
  671.               break;
  672.           if (--i <= 0)
  673. ***************
  674. *** 209,215 ****
  675. --- 226,236 ----
  676.       }
  677.       q = p - 1;
  678.       while (--i > 0) {
  679. + #ifdef __MINT__
  680. +         if (*p != '\0' && *p != '\r')
  681. + #else
  682.           if (*p != '\0')
  683. + #endif
  684.               *q++ = *p;
  685.           p++;
  686.       }
  687. diff --context --recursive --new-file bsd-sh/jobs.c sh03/jobs.c
  688. *** bsd-sh/jobs.c    Fri Feb 19 08:43:54 1993
  689. --- sh03/jobs.c    Sat May 22 00:44:12 1993
  690. ***************
  691. *** 56,61 ****
  692. --- 56,62 ----
  693.   #include "memalloc.h"
  694.   #include "error.h"
  695.   #include "mystring.h"
  696. + #include "redir.h"
  697.   #include <fcntl.h>
  698.   #include <signal.h>
  699.   #include <errno.h>
  700. ***************
  701. *** 509,514 ****
  702. --- 510,518 ----
  703.       {
  704.       int pid;
  705.       int pgrp;
  706. + #ifdef __MINT__
  707. +     int fd;
  708. + #endif
  709.   
  710.       TRACE(("forkshell(%%%d, 0x%x, %d) called\n", jp - jobtab, (int)n, mode));
  711.       INTOFF;
  712. ***************
  713. *** 550,569 ****
  714.           } else if (mode == FORK_BG) {
  715.               ignoresig(SIGINT);
  716.               ignoresig(SIGQUIT);
  717. !             if (jp == NULL || jp->nprocs == 0) {
  718.                   close(0);
  719.                   if (open("/dev/null", O_RDONLY) != 0)
  720.                       error("Can't open /dev/null");
  721.               }
  722.           }
  723.   #else
  724.           if (mode == FORK_BG) {
  725.               ignoresig(SIGINT);
  726.               ignoresig(SIGQUIT);
  727. !             if (jp == NULL || jp->nprocs == 0) {
  728.                   close(0);
  729.                   if (open("/dev/null", O_RDONLY) != 0)
  730.                       error("Can't open /dev/null");
  731.               }
  732.           }
  733.   #endif
  734. --- 554,593 ----
  735.           } else if (mode == FORK_BG) {
  736.               ignoresig(SIGINT);
  737.               ignoresig(SIGQUIT);
  738. !             if ((jp == NULL || jp->nprocs == 0)
  739. !                 && ! fd0_redirected_p ()) {
  740.                   close(0);
  741. + #ifndef __MINT__
  742.                   if (open("/dev/null", O_RDONLY) != 0)
  743.                       error("Can't open /dev/null");
  744. + #else
  745. +                 if ((fd = open("/dev/null", O_RDONLY)) < 0)
  746. +                     error("Can't open /dev/null");
  747. +                 else {
  748. +                     dup2(fd, 0);
  749. +                     close(fd);
  750. +                 }
  751. + #endif
  752.               }
  753.           }
  754.   #else
  755.           if (mode == FORK_BG) {
  756.               ignoresig(SIGINT);
  757.               ignoresig(SIGQUIT);
  758. !             if ((jp == NULL || jp->nprocs == 0)
  759. !                 && ! fd0_redirected_p ()) {
  760.                   close(0);
  761. + #ifndef __MINT__
  762.                   if (open("/dev/null", O_RDONLY) != 0)
  763.                       error("Can't open /dev/null");
  764. + #else
  765. +                 if ((fd = open("/dev/null", O_RDONLY)) < 0)
  766. +                     error("Can't open /dev/null");
  767. +                 else {
  768. +                     dup2(fd, 0);
  769. +                     close(fd);
  770. +                 }
  771. + #endif
  772.               }
  773.           }
  774.   #endif
  775. diff --context --recursive --new-file bsd-sh/main.c sh03/main.c
  776. *** bsd-sh/main.c    Fri Feb 19 08:44:22 1993
  777. --- sh03/main.c    Mon Mar 22 21:10:02 1993
  778. ***************
  779. *** 65,70 ****
  780. --- 65,74 ----
  781.   #include "init.h"
  782.   #include "mystring.h"
  783.   
  784. + #ifdef __MINT__
  785. + long _stksize = 20*1024L;
  786. + #endif
  787.   #define PROFILE 0
  788.   
  789.   int rootpid;
  790. ***************
  791. *** 146,157 ****
  792. --- 150,173 ----
  793.       init();
  794.       setstackmark(&smark);
  795.       procargs(argc, argv);
  796. + #ifdef __MINT__
  797. +     /* under MiNT, we are also a login shell if we've been started
  798. +      * from the desktop with no arguments
  799. +      * hohmuth 22 Mar 1993
  800. +      */
  801. +     if (!argv[0] || (!argv[0][0] && !argv[1]))
  802. +         argv[0] = "-sh";
  803. + #endif
  804.       if (argv[0] && argv[0][0] == '-') {
  805.           state = 1;
  806.           read_profile("/etc/profile");
  807.   state1:
  808.           state = 2;
  809. + #ifdef DOSFS
  810. +         read_profile("profile.sh");
  811. + #else
  812.           read_profile(".profile");
  813. + #endif
  814.       } else if ((sflag || minusc) && (shinit = getenv("SHINIT")) != NULL) {
  815.           state = 2;
  816.           evalstring(shinit);
  817. diff --context --recursive --new-file bsd-sh/miscbltin.c sh03/miscbltin.c
  818. *** bsd-sh/miscbltin.c    Fri Feb 19 08:44:44 1993
  819. --- sh03/miscbltin.c    Sun Mar 21 15:03:18 1993
  820. ***************
  821. *** 99,105 ****
  822. --- 99,109 ----
  823.               status = 1;
  824.               break;
  825.           }
  826. + #ifdef __MINT__
  827. +         if (c == '\0' || c == '\r')
  828. + #else
  829.           if (c == '\0')
  830. + #endif
  831.               continue;
  832.           if (backslash) {
  833.               backslash = 0;
  834. diff --context --recursive --new-file bsd-sh/mkbuiltins sh03/mkbuiltins
  835. *** bsd-sh/mkbuiltins    Fri Feb 19 08:44:48 1993
  836. --- sh03/mkbuiltins    Wed Mar 10 08:33:22 1993
  837. ***************
  838. *** 41,47 ****
  839.   if grep '^#define JOBS[     ]*1' shell.h > /dev/null
  840.   then    havejobs=1
  841.   fi
  842. ! exec > obj/builtins.c
  843.   cat <<\!
  844.   /*
  845.    * This file was generated by the mkbuiltins program.
  846. --- 41,47 ----
  847.   if grep '^#define JOBS[     ]*1' shell.h > /dev/null
  848.   then    havejobs=1
  849.   fi
  850. ! exec > builtins.c
  851.   cat <<\!
  852.   /*
  853.    * This file was generated by the mkbuiltins program.
  854. ***************
  855. *** 66,72 ****
  856.   echo '    NULL, 0
  857.   };'
  858.   
  859. ! exec > obj/builtins.h
  860.   cat <<\!
  861.   /*
  862.    * This file was generated by the mkbuiltins program.
  863. --- 66,72 ----
  864.   echo '    NULL, 0
  865.   };'
  866.   
  867. ! exec > builtins.h
  868.   cat <<\!
  869.   /*
  870.    * This file was generated by the mkbuiltins program.
  871. diff --context --recursive --new-file bsd-sh/parser.c sh03/parser.c
  872. *** bsd-sh/parser.c    Fri Feb 19 08:46:26 1993
  873. --- sh03/parser.c    Sat May 22 00:44:22 1993
  874. ***************
  875. *** 99,105 ****
  876.   STATIC union node *andor __P((void));
  877.   STATIC union node *pipeline __P((void));
  878.   STATIC union node *command __P((void));
  879. ! STATIC union node *simplecmd __P((void));
  880.   STATIC void parsefname __P((void));
  881.   STATIC void parseheredoc __P((void));
  882.   STATIC int readtoken __P((void));
  883. --- 99,105 ----
  884.   STATIC union node *andor __P((void));
  885.   STATIC union node *pipeline __P((void));
  886.   STATIC union node *command __P((void));
  887. ! STATIC union node *simplecmd __P((union node **, union node *));
  888.   STATIC void parsefname __P((void));
  889.   STATIC void parseheredoc __P((void));
  890.   STATIC int readtoken __P((void));
  891. ***************
  892. *** 264,269 ****
  893. --- 264,279 ----
  894.       int t;
  895.   
  896.       checkkwd = 2;
  897. +     redir = 0;
  898. +     rpp = &redir;
  899. +     /* Check for redirection which may precede command */
  900. +     while (readtoken() == TREDIR) {
  901. +         *rpp = n2 = redirnode;
  902. +         rpp = &n2->nfile.next;
  903. +         parsefname();
  904. +     }
  905. +     tokpushback++;
  906.       switch (readtoken()) {
  907.       case TIF:
  908.           n1 = (union node *)stalloc(sizeof (struct nif));
  909. ***************
  910. *** 326,331 ****
  911. --- 336,345 ----
  912.               }
  913.               *app = NULL;
  914.               n1->nfor.args = ap;
  915. +             /* A newline or semicolon is required here to end
  916. +                the list.  */
  917. +             if (lasttoken != TNL && lasttoken != TSEMI)
  918. +                 synexpect(-1);
  919.           } else {
  920.   #ifndef GDB_HACK
  921.               static const char argvars[5] = {CTLVAR, VSNORMAL|VSQUOTE,
  922. ***************
  923. *** 337,345 ****
  924.               n2->narg.backquote = NULL;
  925.               n2->narg.next = NULL;
  926.               n1->nfor.args = n2;
  927.           }
  928. -         if (lasttoken != TNL && lasttoken != TSEMI)
  929. -             synexpect(-1);
  930.           checkkwd = 2;
  931.           if ((t = readtoken()) == TDO)
  932.               t = TDONE;
  933. --- 351,361 ----
  934.               n2->narg.backquote = NULL;
  935.               n2->narg.next = NULL;
  936.               n1->nfor.args = n2;
  937. +             /* A newline or semicolon is optional here. Anything
  938. +                else gets pushed back so we can read it again.  */
  939. +             if (lasttoken != TNL && lasttoken != TSEMI)
  940. +                 tokpushback++;
  941.           }
  942.           checkkwd = 2;
  943.           if ((t = readtoken()) == TDO)
  944.               t = TDONE;
  945. ***************
  946. *** 411,426 ****
  947.               synexpect(TEND);
  948.           checkkwd = 1;
  949.           break;
  950.       case TWORD:
  951. -     case TREDIR:
  952.           tokpushback++;
  953. !         return simplecmd();
  954.       default:
  955.           synexpect(-1);
  956.       }
  957.   
  958.       /* Now check for redirection which may follow command */
  959. -     rpp = &redir;
  960.       while (readtoken() == TREDIR) {
  961.           *rpp = n2 = redirnode;
  962.           rpp = &n2->nfile.next;
  963. --- 427,442 ----
  964.               synexpect(TEND);
  965.           checkkwd = 1;
  966.           break;
  967. +     /* Handle an empty command like other simple commands.  */
  968. +     case TNL:
  969.       case TWORD:
  970.           tokpushback++;
  971. !         return simplecmd(rpp, redir);
  972.       default:
  973.           synexpect(-1);
  974.       }
  975.   
  976.       /* Now check for redirection which may follow command */
  977.       while (readtoken() == TREDIR) {
  978.           *rpp = n2 = redirnode;
  979.           rpp = &n2->nfile.next;
  980. ***************
  981. *** 442,455 ****
  982.   
  983.   
  984.   STATIC union node *
  985. ! simplecmd() {
  986.       union node *args, **app;
  987. !     union node *redir, **rpp;
  988.       union node *n;
  989.   
  990.       args = NULL;
  991.       app = &args;
  992. !     rpp = &redir;
  993.       for (;;) {
  994.           if (readtoken() == TWORD) {
  995.               n = (union node *)stalloc(sizeof (struct narg));
  996. --- 458,481 ----
  997.   
  998.   
  999.   STATIC union node *
  1000. ! simplecmd(rpp, redir)
  1001. !     union node **rpp, *redir;
  1002. !     {
  1003.       union node *args, **app;
  1004. !     union node **orig_rpp = rpp;
  1005.       union node *n;
  1006.   
  1007. +     /* If we don't have any redirections already, then we must reset
  1008. +        rpp to be the address of the local redir variable.  */
  1009. +     if (redir == 0)
  1010. +         rpp = &redir;
  1011.       args = NULL;
  1012.       app = &args;
  1013. !     /* We save the incoming value, because we need this for shell
  1014. !        functions.  There can not be a redirect or an argument between
  1015. !        the function name and the open parenthesis.  */
  1016. !     orig_rpp = rpp;
  1017.       for (;;) {
  1018.           if (readtoken() == TWORD) {
  1019.               n = (union node *)stalloc(sizeof (struct narg));
  1020. ***************
  1021. *** 463,469 ****
  1022.               rpp = &n->nfile.next;
  1023.               parsefname();    /* read name of redirection file */
  1024.           } else if (lasttoken == TLP && app == &args->narg.next
  1025. !                         && rpp == &redir) {
  1026.               /* We have a function */
  1027.               if (readtoken() != TRP)
  1028.                   synexpect(TRP);
  1029. --- 489,495 ----
  1030.               rpp = &n->nfile.next;
  1031.               parsefname();    /* read name of redirection file */
  1032.           } else if (lasttoken == TLP && app == &args->narg.next
  1033. !                         && rpp == orig_rpp) {
  1034.               /* We have a function */
  1035.               if (readtoken() != TRP)
  1036.                   synexpect(TRP);
  1037. ***************
  1038. *** 836,847 ****
  1039.                   }
  1040.                   break;
  1041.               case CBQUOTE:    /* '`' */
  1042. -                 if (parsebackquote && syntax == BASESYNTAX) {
  1043. -                     if (out == stackblock())
  1044. -                         return lasttoken = TENDBQUOTE;
  1045. -                     else
  1046. -                         goto endword;    /* exit outer loop */
  1047. -                 }
  1048.                   PARSEBACKQOLD();
  1049.                   break;
  1050.               case CEOF:
  1051. --- 862,867 ----
  1052. ***************
  1053. *** 855,861 ****
  1054.           }
  1055.       }
  1056.   endword:
  1057. !     if (syntax != BASESYNTAX && eofmark == NULL)
  1058.           synerror("Unterminated quoted string");
  1059.       if (varnest != 0) {
  1060.           startlinno = plinno;
  1061. --- 875,881 ----
  1062.           }
  1063.       }
  1064.   endword:
  1065. !     if (syntax != BASESYNTAX && ! parsebackquote && eofmark == NULL)
  1066.           synerror("Unterminated quoted string");
  1067.       if (varnest != 0) {
  1068.           startlinno = plinno;
  1069. ***************
  1070. *** 1048,1054 ****
  1071.       struct jmploc jmploc;
  1072.       struct jmploc *volatile savehandler;
  1073.       int savelen;
  1074. -     int t;
  1075.   
  1076.       savepbq = parsebackquote;
  1077.       if (setjmp(jmploc.loc)) {
  1078. --- 1068,1073 ----
  1079. ***************
  1080. *** 1068,1073 ****
  1081. --- 1087,1119 ----
  1082.       savehandler = handler;
  1083.       handler = &jmploc;
  1084.       INTON;
  1085. +     if (oldstyle) {
  1086. +         /* We must read until the closing backquote, giving special
  1087. +            treatment to some slashes, and then push the string and
  1088. +            reread it as input, interpreting it normally.  */
  1089. +         register char *out;
  1090. +         register c;
  1091. +         int savelen;
  1092. +         char *str;
  1093. +         STARTSTACKSTR(out);
  1094. +         while ((c = pgetc ()) != '`') {
  1095. +             if (c == '\\') {
  1096. +                 c = pgetc ();
  1097. +                 if (c != '\\' && c != '`' && c != '$'
  1098. +                     && (!dblquote || c != '"'))
  1099. +                     STPUTC('\\', out);
  1100. +             }
  1101. +             STPUTC(c, out);
  1102. +         }
  1103. +         STPUTC('\0', out);
  1104. +         savelen = out - stackblock();
  1105. +         if (savelen > 0) {
  1106. +             str = ckmalloc(savelen);
  1107. +             bcopy(stackblock(), str, savelen);
  1108. +         }
  1109. +         setinputstring(str, 1);
  1110. +     }
  1111.       nlpp = &bqlist;
  1112.       while (*nlpp)
  1113.           nlpp = &(*nlpp)->next;
  1114. ***************
  1115. *** 1075,1084 ****
  1116.       (*nlpp)->next = NULL;
  1117.       parsebackquote = oldstyle;
  1118.       n = list(0);
  1119. !     t = oldstyle? TENDBQUOTE : TRP;
  1120. !     if (readtoken() != t)
  1121. !         synexpect(t);
  1122.       (*nlpp)->n = n;
  1123.       while (stackblocksize() <= savelen)
  1124.           growstackblock();
  1125.       STARTSTACKSTR(out);
  1126. --- 1121,1132 ----
  1127.       (*nlpp)->next = NULL;
  1128.       parsebackquote = oldstyle;
  1129.       n = list(0);
  1130. !     if (!oldstyle && (readtoken() != TRP))
  1131. !         synexpect(TRP);
  1132.       (*nlpp)->n = n;
  1133. +     /* Start reading from old file again.  */
  1134. +     if (oldstyle)
  1135. +         popfile();
  1136.       while (stackblocksize() <= savelen)
  1137.           growstackblock();
  1138.       STARTSTACKSTR(out);
  1139. diff --context --recursive --new-file bsd-sh/redir.c sh03/redir.c
  1140. *** bsd-sh/redir.c    Fri Feb 19 08:46:40 1993
  1141. --- sh03/redir.c    Sat May 22 00:44:30 1993
  1142. ***************
  1143. *** 68,73 ****
  1144. --- 68,77 ----
  1145.   
  1146.   MKINIT struct redirtab *redirlist;
  1147.   
  1148. + /* We keep track of whether or not fd0 has been redirected.  This is for
  1149. +    background commands, where we want to redirect fd0 to /dev/null only
  1150. +    if it hasn't already been redirected.  */
  1151. + int fd0_redirected = 0;
  1152.   
  1153.   #ifdef __STDC__
  1154.   STATIC void openredirect(union node *, char *);
  1155. ***************
  1156. *** 122,127 ****
  1157. --- 126,133 ----
  1158.           } else {
  1159.               close(fd);
  1160.           }
  1161. +         if (fd == 0)
  1162. +             fd0_redirected++;
  1163.           openredirect(n, memory);
  1164.       }
  1165.       if (memory[1])
  1166. ***************
  1167. *** 255,260 ****
  1168. --- 261,268 ----
  1169.   
  1170.       for (i = 0 ; i < 10 ; i++) {
  1171.           if (rp->renamed[i] != EMPTY) {
  1172. +             if (i == 0)
  1173. +                 fd0_redirected--;
  1174.               close(i);
  1175.               if (rp->renamed[i] >= 0) {
  1176.                   copyfd(rp->renamed[i], i);
  1177. ***************
  1178. *** 348,350 ****
  1179. --- 356,364 ----
  1180.       return newfd;
  1181.   #endif
  1182.   }
  1183. + /* Return true if fd 0 has already been redirected at least once.  */
  1184. + int
  1185. + fd0_redirected_p () {
  1186. +     return fd0_redirected != 0;
  1187. + }
  1188. diff --context --recursive --new-file bsd-sh/redir.h sh03/redir.h
  1189. *** bsd-sh/redir.h    Fri Feb 19 08:46:44 1993
  1190. --- sh03/redir.h    Sat May 22 00:44:34 1993
  1191. ***************
  1192. *** 46,54 ****
  1193. --- 46,56 ----
  1194.   void popredir(void);
  1195.   void clearredir(void);
  1196.   int copyfd(int, int);
  1197. + int fd0_redirected_p(void);
  1198.   #else
  1199.   void redirect();
  1200.   void popredir();
  1201.   void clearredir();
  1202.   int copyfd();
  1203. + int fd0_redirected_p();
  1204.   #endif
  1205. diff --context --recursive --new-file bsd-sh/shell.h sh03/shell.h
  1206. *** bsd-sh/shell.h    Fri Feb 19 08:47:10 1993
  1207. --- sh03/shell.h    Sun Mar 14 07:10:46 1993
  1208. ***************
  1209. *** 57,66 ****
  1210.   #define JOBS 1
  1211.   #define SYMLINKS 1
  1212.   #define DIRENT 1
  1213. ! #define UDIR 0
  1214.   #define ATTY 0
  1215.   #define BSD
  1216. ! #define DEBUG 1
  1217.   
  1218.   #ifdef __STDC__
  1219.   typedef void *pointer;
  1220. --- 57,66 ----
  1221.   #define JOBS 1
  1222.   #define SYMLINKS 1
  1223.   #define DIRENT 1
  1224. ! #define UDIR 1
  1225.   #define ATTY 0
  1226.   #define BSD
  1227. ! #define DEBUG 0
  1228.   
  1229.   #ifdef __STDC__
  1230.   typedef void *pointer;
  1231. diff --context --recursive --new-file bsd-sh/sys/cdefs.h sh03/sys/cdefs.h
  1232. *** bsd-sh/sys/cdefs.h
  1233. --- sh03/sys/cdefs.h    Tue Feb 16 00:00:00 1993
  1234. ***************
  1235. *** 0 ****
  1236. --- 1,15 ----
  1237. + #ifndef cdefs_h
  1238. + #define cdefs_h
  1239. + #include <stddef.h>
  1240. + #include <sys/types.h>
  1241. + #include <signal.h>
  1242. + typedef void *sig_t;
  1243. + #ifdef __STDC__
  1244. + # define __P(x) x
  1245. + #else
  1246. + # define __P(x) ()
  1247. + #endif
  1248. + #endif
  1249. diff --context --recursive --new-file bsd-sh/var.c sh03/var.c
  1250. *** bsd-sh/var.c    Fri Feb 19 08:48:00 1993
  1251. --- sh03/var.c    Wed Feb 17 07:12:18 1993
  1252. ***************
  1253. *** 81,87 ****
  1254.   struct var vterm;
  1255.   #endif
  1256.   
  1257. ! const struct varinit varinit[] = {
  1258.   #if ATTY
  1259.       {&vatty,    VSTRFIXED|VTEXTFIXED|VUNSET,    "ATTY="},
  1260.   #endif
  1261. --- 81,90 ----
  1262.   struct var vterm;
  1263.   #endif
  1264.   
  1265. ! #ifndef __MBASE__
  1266. ! const 
  1267. ! #endif
  1268. ! struct varinit varinit[] = {
  1269.   #if ATTY
  1270.       {&vatty,    VSTRFIXED|VTEXTFIXED|VUNSET,    "ATTY="},
  1271.   #endif
  1272.